<?php

use yii\helpers\Html;
use yii\helpers\Url;
use backend\widgets\common\LinkPages;

$this->title = '角色&权限列表';
$this->params['breadcrumbs'][] = $this-> title;
$this->registerJsFile('/status/js/table_base.js',[ 'depends'=> 'backend\assets\AppAsset']);
?>
<style>
    table tbody tr th{text-align: center; background-color: #FC9D9A; color: #fff;}
   	table tbody tr td{text-align: center;}
    .search-container{margin-bottom: 10px;}
    .input-append{width: 350px; height: 40px;}
    .btn { background-color: #FC9D9A; width: 70px; color: #fff; margin-top: 2px; }
    .search-option_div{ width: 100px; height: 40px; border: 1px solid #eee; float: left; margin-right: 10px}
    .search-option{float: left; width: 100%; border: 0px; height: 100%;outline:none; }
    .input_wrap{ width: 150px; height: 40px; border: 1px solid #eee; float: left;margin-right: 10px}
    .input_wrap input{ width: 100%; border: 0px; height: 100%;outline:none; padding-left: 10px;}
    .btn:focus, .btn:hover {color: #fff;}
    .btn-success{width: 130px}
    .page{float: right}
</style>
<div class="ibox-title">
	<h5>权限/角色列表</h5>
</div>
<div class="ibox-content timeline">
    <div class="auth-item-model-form">

<div class="auth-item-model-index">
    <div class ="search-container" >
        <?=Html::a("权限/角色创建 <i class='icon-plus'></i>" , ['create'], ['class' => 'btn btn-success']) ?>
       <form action ="" class="form-search pull-right" >
            <div class ="input-append" >
                <div class="search-option_div">
                    <select name ="type" class="search-option">
                       <option value ="name">名称</ option>
                    </select >
                </div>
                <div class="input_wrap">
                    <input name ="value" class="m-wrap" type="text" placeholder= "请输入搜索内容" >
                </div>
                <button class ="btn green" type= "submit">搜索</button >
            </div >
     </form >
    </div >

    <div class="summary">
        <?=Yii::t('common' , '{start}-{end} a total of {total}',['start' => $data[ 'start'], 'end'=> $data['end'],'total'=> $data['count' ]])?> </div >
        <table class ="table table-striped table-bordered table_base">
            <tbody >
                <tr>
                    <th ># </th >
                    <th >名称 </th >
                    <th >类型 </th >
                    <th >描述 </th >
                    <th >创建时间 </th >
                    <th >操作 </th >
                </tr >
                <?php if ( empty($data[ 'data'])): ?>
                <tr ><td colspan ="20"><?=Yii::t('common' ,'Not find data') ?> </td ></tr >
                <?php else: ?>
                <?php $i = $data['start'];?>
                <?php foreach ( $data['data'] as $list):?>
                <tr data-key ="<?=$list['name'] ?>" >
                    <td ><?= $i++?> </td >
                    <td ><?= Html::encode($list[ 'name']) ?></ td>
                    <td ><?= Html::encode(($list[ 'type']==1)? '角色': '权限')?></ td>
                    <td ><?= Html::encode($list[ 'description']) ?></ td>
                    <td> <?= Html::encode($list['created_at']?date('Y-m-d',$list['created_at']):'未设置') ?></ td>
                    <td >
                        <a href= "<?= Url::to([ 'update', 'id'=>$list[ 'name']]); ?>" >编辑 </a >
                        <a class ="del" href= "javascript:;">删除</a >
                    </td >
                </tr >
                <?php endforeach; ?>
                <?php endif; ?>
            </tbody >
        </table >
        <div class="page"><?=LinkPages:: widget(['pagination' => $pages]);?></div>
        <input type ="hidden" name="delUrl" value= "<?= Url::to([ 'delete']) ?>" >
    </div>
</div>